<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../js/vue.min.js"></script>
    <script src="../js/jquery-3.6.1.min.js"></script>
  </head>

  <body>
    <div id="app">
      {{message}}
      <hr />
      <p>{{name}}</p>
      <p>{{age}}</p>
      <p>{{gender}}</p>
      <button @click="fun1">fun1</button>
    </div>
  </body>
  <script>
    var app = new Vue({
      el: "#app",
      data: {
        message: "Hello Vue!",
        name: "张三",
        age: 18,
        gender: "",
      },
      methods: {
        fun1: function () {
          $.ajax({
            type: "post",
            url: "http://localhost:8080/login",
            data: {
              username: "111",
              password: "111",
            },
            success: function (data) {
              console.log(data);
              app.name = data.aaa;
              app.age = data.bbb;
              app.gender = data.ccc;
            },
          });
        },
      },
    });
  </script>
</html>
